// Copyright (c) 2024, hzmes and contributors
// For license information, please see license.txt

frappe.ui.form.on("Expense Allocation", {
	// refresh(frm) {

	// },
  date: function (frm) {
    let y = parseInt(frm.doc.date.substring(0,4));
    let m = parseInt(frm.doc.date.substring(5,7));
    frm.set_value('year', y);
    frm.set_value('month', m);
  },
  is_adjust: function(frm) {
    if (frm.doc.is_adjust === 1) { frm.set_value('month', 13); }
    if (frm.doc.is_adjust === 0) { let m = parseInt(frm.doc.date.substring(5,7)); frm.set_value('month', m); }
  }
});
